package com.qf.contorller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.service.MaterialService;
import com.qf.utils.R;
import com.qf.vo.MaterialVo;
import com.qf.vo.StorageVo1;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zdl
 * @date 2025/2/15
 */
@RestController
@RequestMapping("/material")
public class MaterialController {
    @Resource
    private MaterialService materialService;

    @GetMapping("/all")
    public R<PageInfo<StorageVo1>> findAllMaterial(@RequestParam int pageNum, @RequestParam int pageSize){
        PageHelper.startPage(pageNum,pageSize);
        List<StorageVo1> allMaterials = materialService.findAllMaterials();
        PageInfo<StorageVo1> storageVo1PageInfo = new PageInfo<>(allMaterials);
        return R.ok(storageVo1PageInfo);
    }
}
